package com.zmj.sy.mom.srv.aps.utils;

public class OrderUtils {


    public static String partType(String plmId, String materName) {

        String partType = partType(materName);
        if (partType == null) {
            throw SyExceptionUtils.e("未知类型，请报备");
        }

        return partType;
    }

    public static String partType(String materName) {

        if (materName.endsWith("护帮") || materName.endsWith("护帮板")) {
            return "B";
        }

        if (materName.startsWith("推杆体") || materName.startsWith("推杆")) {
            return "T";
        }

        if (materName.endsWith("护板") || materName.equals("挡板组件")) {
            return "C";
        }

        if (materName.endsWith("连杆") || materName.equals("连杆体")) {
            return "L";
        }

        if (materName.startsWith("顶梁") && materName.endsWith("拼")) {
            return "D";
        }

        if (materName.startsWith("掩护梁") && materName.endsWith("拼")) {
            return "Y";
        }

        if (materName.startsWith("底座") && materName.endsWith("拼")) {
            return "Z";
        }

        if (materName.endsWith("焊接件")) {
            return "W";
        }

        return null;
    }

    public static String partName(String orderSuffix) {
        if (orderSuffix.equals("C")) {
            return "侧板";
        }

        if (orderSuffix.equals("L")) {
            return "连杆";
        }

        if (orderSuffix.equals("W")) {
            return "外揽";
        }

        if (orderSuffix.equals("T")) {
            return "推杆";
        }

        if (orderSuffix.equals("B")) {
            return "护帮";
        }

        throw SyExceptionUtils.e("不支持的类型!");
    }


}
